#include <windows.h>
#include <string>
int system_ex(const char *cmd_ptr,bool show=false)
{
	STARTUPINFOA startInfo;

	memset(&startInfo,0,sizeof(startInfo));
	startInfo.cb = sizeof(startInfo);

	PROCESS_INFORMATION	procInfo;

	char dir[MAX_PATH];

	GetSystemDirectoryA(dir,sizeof(dir));

	std::string cmd_fall_name = dir;

	cmd_fall_name += "\\cmd.exe";

	std::string cmd_line = cmd_fall_name + " /c " + cmd_ptr;

	BOOL b = CreateProcessA(cmd_fall_name.c_str(),(char*)cmd_line.c_str(),
		NULL,NULL,NULL,NORMAL_PRIORITY_CLASS | (show? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW),NULL,
		NULL,&startInfo,&procInfo);

	if (b)
	{
		DWORD exit_code;
		WaitForSingleObject(procInfo.hProcess,INFINITE);
		GetExitCodeProcess(procInfo.hProcess,&exit_code);
		CloseHandle(procInfo.hThread);
		CloseHandle(procInfo.hProcess);
		return exit_code;
	}
	return 0;
}
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	static const char* cmds[] = 
	{
		"xcopy GameHack\\*.* \"%VS90COMNTOOLS%..\\..\\VC\\vcprojects\\GameHack\\\" /y",
		"xcopy GameHackWizard\\*.* \"%VS90COMNTOOLS%..\\..\\VC\\VCWizards\\GameHackWizard\\\" /y /s"
	};
	for (int i = 0; i < _countof(cmds); ++i)
	{
		system_ex(cmds[i]);
	}
	return 0;
}